﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Happy.Archetype;
using Happy.Query;
using Happy.Application.Query.CommonModel.TreeLike;
using Happy.Cms.Query.Categories;

namespace Happy.Cms.Application.Categories
{
    [QueryService]
    public sealed class CategoryQueryService : TreeNodeQueryService<CategoryView>
    {
        protected override Happy.Query.Filters.FilterDefinition FilterDefinition
        {
            get
            {
                return null;
            }
        }

        public CategoryView FindByName(string name)
        {
            var query = QueryArgument.Create(new { Name = name });

            return this.QuerySource.SingleOrDefault(query);
        }
    }
}
